import { createStore } from 'vuex'

export default createStore({
  state: {
    num1:11,
    num2:33
  },
  getters:{
    double(state){
      return state.num1 * 2;
    },
    double2(state){
      return state.num2 * 2;
    }
  },
  mutations: {
    chanageNum1(state,payLoad){
      state.num1 = payLoad;
    },
    chanageNum2(state,payLoad){
      state.num2 = payLoad;
    }
  },
  actions: {
    timeCnum1({commit,state}){
      setTimeout(()=>{
        commit('chanageNum1',55);
      },5000)
    },
    timeCnum2({commit,state}){
      setTimeout(()=>{
        commit('chanageNum2',66);
      },5000)
    }
  },
  modules: {
  }
})
